'use strict';

var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify')
var clean = require('gulp-clean-css')


gulp.task('minifyCss', function() {
  return gulp.src([
	  'libs/bootstrap/dist/css/bootstrap.css',
      'libs/codemirror/lib/codemirror.css',
      'libs/hotbox/hotbox.css',
      'libs/kityminder-core/dist/kityminder.core.css',
      'libs/color-picker/dist/color-picker.min.css'
    ])
    .pipe(concat('components.css'))
    .pipe(clean())
    .pipe(gulp.dest('.'));
});

gulp.task('minifyJs', function() {
  return gulp.src([
	  'libs/jquery/dist/jquery.js',
      'libs/bootstrap/dist/js/bootstrap.js',
      'libs/angular/angular.js',
      'libs/angular-bootstrap/ui-bootstrap-tpls.js',
      'libs/codemirror/lib/codemirror.js',
      'libs/codemirror/mode/xml/xml.js',
      'libs/codemirror/mode/javascript/javascript.js',
      'libs/codemirror/mode/css/css.js',
      'libs/codemirror/mode/htmlmixed/htmlmixed.js',
      'libs/codemirror/mode/markdown/markdown.js',
      'libs/codemirror/addon/mode/overlay.js',
      'libs/codemirror/mode/gfm/gfm.js',
      'libs/angular-ui-codemirror/ui-codemirror.js',
	  'libs/marked/lib/marked.js',
	  'libs/kity/dist/kity.min.js',
      'libs/hotbox/hotbox.js',
	  'libs/json-diff/json-diff.js',
      'libs/kityminder-core/dist/kityminder.core.min.js',
      'libs/color-picker/dist/color-picker.min.js'])
    .pipe(concat('components.js'))
    .pipe(uglify())
    .pipe(gulp.dest('.'));
});

gulp.task('build', ['minifyCss', 'minifyJs']);
